chrome.runtime.onInstalled.addListener(() => {
	console.log("扩展程序安装完成");
	// 启用侧面板在动作点击时打开
	chrome.sidePanel.setPanelBehavior({
		openPanelOnActionClick: true
	});
	// background.js

});

chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
	if (request.type === 'fetchData') {
		fetch(request.url).then(response => {
			return response.json(); // 假设返回的是JSON数据
		}).then(data => {
			chrome.runtime.sendMessage({
				type: 'dataFetched',
				data: data
			});
		}).catch(error => {
			console.error('Fetch error:', error);
		});
	}
});
